<!DOCTYPE html>
<meta name="color-scheme" content="light dark">
<body>
    <div id="target">This is some basic text that we are going to select.</div>
    <script>
        let targetText = document.querySelector("#target").firstChild;
        let selectionRange = window.getSelection();
        selectionRange.setBaseAndExtent(targetText, 5, targetText, 35);
    </script>
</body>
